package org.springblade.modules.platform.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springblade.modules.platform.dto.NoticeTableListByPageDTO;
import org.springblade.modules.platform.dto.NoticeTableResionDTO;
import org.springblade.modules.platform.service.INoticeTableService;
import org.springblade.modules.platform.vo.NoticeTableInfoVO;
import org.springblade.modules.platform.vo.NoticeTableListByPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author SYG
 * @since 2022-08-25
 */

@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/service-huateng-sxdb/noticeTable")
@Api(value = "通知列表接口", tags = "通知列表接口")
public class NoticeTableController {
    private final INoticeTableService iNoticeTableService;


    @ApiLog("分页")
    @GetMapping("/getListByPage")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "分页", notes = "传入noticeTableListByPageDTO")
    public R<NoticeTableListByPageVO> getListByPage(NoticeTableListByPageDTO noticeTableListByPageDTO){

        return R.data(iNoticeTableService.getListByPage(noticeTableListByPageDTO,null));
    }

    @PutMapping(value = "/updateReason")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "处理", notes = "传入sysJob")
    public R updateReason(@RequestBody NoticeTableResionDTO noticeTableResionDTO){
        iNoticeTableService.updateReason(noticeTableResionDTO);
        return R.success("成功");
    }



    @GetMapping(value = "/info/{id}")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "获取详细信息", notes = "传入id")
    public  R<NoticeTableInfoVO> getInfo(@PathVariable("id") Integer id) {
        return R.data(iNoticeTableService.getInfo(id));
    }
}

